/*
 * Copyright 2002-2021 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.core.io;

import org.springframework.lang.Nullable;
import org.springframework.util.ResourceUtils;

/**
 * Spring框架为了更方便的获取资源，尽量弱化程序员对各个Resource接口的实现类的感知，定义了另一个ResourceLoader接口。
 * 接口有一个特别重要的方法：Resource getResource(String location)，返回Resource实例。因此程序员在使用Spring容器时，
 * 可以不去过于计较底层Resource的实现，也不需要自己创建Resource实现类，而是直接使用ReourceLoader，获取到bean容器本身的Resource，
 * 进而取到相关的资源信息。
 */
public interface ResourceLoader {

	/** Pseudo URL prefix for loading from the class path: "classpath:". */
	String CLASSPATH_URL_PREFIX = ResourceUtils.CLASSPATH_URL_PREFIX;

	/*用来根据location来获取指定的资源*/
	Resource getResource(String location);
	/*获取类加载器*/
	@Nullable
	ClassLoader getClassLoader();

}
